//
//  MHMyselfHeaderView.m
//  ManHua
//
//  Created by 江子安 on 15/10/27.
//  Copyright © 2015年 蓝欧科技. All rights reserved.
//

#import "MHMyselfHeaderView.h"
#import "UIImage+Addiction.h"
#import "MHUserInfoSington.h"

@implementation MHMyselfHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        CGFloat padding = 10;
        
        CGFloat iconW = 35;
        CGFloat iconX = 20;
        CGFloat iconY = Height * 0.1;
        _iconImg = [[UIImageView alloc]initWithFrame:CGRectMake(iconX, iconY, iconW, iconW)];
        _iconImg.image = [UIImage circleImageWithImage:[UIImage imageNamed:@"akalin.jpg"] borderWidth:0 borderColor:[UIColor clearColor]] ;
        _iconImg.layer.cornerRadius = iconW / 2;
        _iconImg.layer.masksToBounds = YES;
        [self addSubview:_iconImg];
        
        CGFloat nameLabelX = CGRectGetMaxX(_iconImg.frame) + padding;
        CGFloat nameLabelY = iconY;
        CGFloat nameLabelW = 150;
        CGFloat nameLabelH = 30;
        _loginOrNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(nameLabelX, nameLabelY, nameLabelW, nameLabelH)];
        _loginOrNameLabel.text = @"登录 / 注册";
        _loginOrNameLabel.textColor = [UIColor whiteColor];
        [self addSubview:_loginOrNameLabel];
        
        CGFloat descLabelX = nameLabelX;
        CGFloat descLabelY = CGRectGetMaxY(_loginOrNameLabel.frame) + 5;
        CGFloat descLabelW = nameLabelW;
        CGFloat descLabelH = 20;
        _descLabel = [[UILabel alloc]initWithFrame:CGRectMake(descLabelX, descLabelY, descLabelW, descLabelH)];
        _descLabel.text = @"登陆后有很多好处哦~";
        _descLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:_descLabel];
        
        CGFloat loginX = 0;
        CGFloat loginY = iconY;
        CGFloat loginW = CGRectGetMaxX(_loginOrNameLabel.frame);
        CGFloat loginH = iconW;
        _loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _loginBtn.frame = CGRectMake(loginX, loginY, loginW, loginH);
        [self addSubview:_loginBtn];
        
        
    }
    return self;
}
@end
